/**
 * 
 */
package com.java.test.system.dto;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.RowMapper;

/**
 * @author 菜单
 *
 */
public class MenuInfo implements RowMapper<MenuInfo> {

	// 菜单id
	private int id;

	// 父级菜单id
	private int parentid;

	// 菜单名称
	private String menuName;

	// 重定向url
	private String redirect;

	// 路由url
	private String menuUrl;

	List<MenuInfo> children;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getMenuName() {
		return menuName;
	}

	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}

	public String getMenuUrl() {
		return menuUrl;
	}

	public void setMenuUrl(String menuUrl) {
		this.menuUrl = menuUrl;
	}

	public String getRedirect() {
		return redirect;
	}

	public void setRedirect(String redirect) {
		this.redirect = redirect;
	}

	public List<MenuInfo> getChildren() {
		return children;
	}

	public void setChildren(List<MenuInfo> children) {
		this.children = children;
	}

	public int getParentid() {
		return parentid;
	}

	public void setParentid(int parentid) {
		this.parentid = parentid;
	}

	@Override
	public MenuInfo mapRow(ResultSet rs, int rowNum) throws SQLException {

		MenuInfo info = new MenuInfo();

		info.setParentid(rs.getInt("parent_id"));

		info.setId(rs.getInt("id"));

		info.setMenuName(rs.getString("menu_name"));

		info.setMenuUrl(rs.getString("menu_url"));

		info.setRedirect(rs.getString("menu_url"));

		return info;
	}

}
